home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / studio / common / scrollbar.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  4KB  |  142 lines

  1. /*
  2.  
  3.   Nullsoft WASABI Source File License
  4.  
  5.   Copyright 1999-2001 Nullsoft, Inc.
  6.  
  7.     This software is provided 'as-is', without any express or implied
  8.     warranty.  In no event will the authors be held liable for any damages
  9.     arising from the use of this software.
  10.  
  11.     Permission is granted to anyone to use this software for any purpose,
  12.     including commercial applications, and to alter it and redistribute it
  13.     freely, subject to the following restrictions:
  14.  
  15.     1. The origin of this software must not be misrepresented; you must not
  16.        claim that you wrote the original software. If you use this software
  17.        in a product, an acknowledgment in the product documentation would be
  18.        appreciated but is not required.
  19.     2. Altered source versions must be plainly marked as such, and must not be
  20.        misrepresented as being the original software.
  21.     3. This notice may not be removed or altered from any source distribution.
  22.  
  23.  
  24.   Brennan Underwood
  25.   brennan@nullsoft.com
  26.  
  27. */
  28.  
  29. #ifndef __SCROLLBAR_H
  30. #define __SCROLLBAR_H
  31.  
  32. #include "virtualwnd.h"
  33. #include "region.h"
  34. #include "usermsg.h"
  35. #include "autobitmap.h"
  36.  
  37. #define SCROLLBAR_PARENT VirtualWnd
  38.  
  39. #define SCROLLBAR_FULL 65535
  40.  
  41. #define POS_NONE    0
  42. #define POS_LEFT    1
  43. #define POS_BUTTON  2
  44. #define POS_RIGHT   3
  45.  
  46. #define PAGE_NONE   0
  47. #define PAGE_DOWN   1
  48. #define PAGE_UP     2
  49.  
  50. #define DEFAULT_HEIGHT 16
  51.  
  52. class COMEXP ScrollBar : public SCROLLBAR_PARENT {
  53. public:
  54.   ScrollBar();
  55.   virtual ~ScrollBar();
  56.  
  57.   virtual int onMouseMove (int x, int y);
  58.   virtual int onLeftButtonDown(int x, int y);
  59.   virtual int onLeftButtonUp(int x, int y);
  60.   virtual int onRightButtonDown(int x, int y);
  61.   virtual int onRightButtonUp(int x, int y);
  62.   virtual int onMouseWheelUp(int clicked, int lines);
  63.   virtual int onMouseWheelDown(int clicked, int lines);
  64.   virtual int onPaint(Canvas *canvas);
  65.   virtual int onResize();
  66.   virtual int onInit();
  67.   virtual void timerCallback(int id);
  68.  
  69.   virtual int wantDoubleClicks() { return 0; };
  70.  
  71.   virtual int onSetPosition(BOOL smooth=FALSE);
  72.   virtual int onSetFinalPosition();
  73.  
  74.   void setBitmaps(char *left, char *lpressed, char *lhilite,
  75.                   char *right, char *rpressed, char *rhilite, 
  76.                   char *button, char *bpressed, char *bhilite);
  77.   void setPosition(int pos);
  78.   int getPosition();
  79.   int getHeight();
  80.   void setHeight(int newheight);
  81.   void setNPages(int n);
  82.   void gotoPage(int n);
  83.   void setUpDownValue(int newupdown);
  84.   void setVertical(BOOL isvertical);
  85.   int getWidth();
  86.  
  87.   virtual void freeResources();
  88.   virtual void reloadResources();
  89.  
  90. private:
  91.   void deleteResources();
  92.   int getMousePosition();
  93.   void calcOverlapping();
  94.   void calcXPosition();
  95.   void calcPosition();
  96.   void handlePageUpDown();
  97.   int checkPageUpDown();
  98.   void handleUpDown();
  99.   int checkUpDown();
  100.   int pageUp();
  101.   int pageDown();
  102.   int upDown(int which);
  103.   void setPrivatePosition(int pos, BOOL signal=TRUE, BOOL smooth=FALSE);
  104.   void loadBmps();
  105.  
  106.   AutoSkinBitmap bmpleft, bmplpressed, bmplhilite,
  107.              bmpright, bmprpressed, bmprhilite,
  108.              bmpbutton, bmpbpressed, bmpbhilite;
  109.  
  110.   Region *leftrgn, *rightrgn, *buttonrgn;
  111.   int position;
  112.  
  113.   int moving;
  114.   int lefting;
  115.   int righting;
  116.   int clicked;
  117.  
  118.   int buttonx;
  119.  
  120.   int curmouseposition;
  121.   int clickmouseposition;
  122.   int height;
  123.  
  124.   int shiftleft, shiftright;
  125.   POINT clickpos;
  126.   int clickbuttonx;
  127.   int pageing;
  128.   int firstdelay;
  129.   int timer;
  130.   int npages;
  131.   int pageway;
  132.   int updown;
  133.   int timer2;
  134.   int insetpos;
  135.  
  136.   int vertical;
  137.   int lastx, lasty;
  138. };
  139.  
  140.  
  141. #endif
  142.